package com.example.myapplication.model;

import com.example.myapplication.base.BaseModel;
import com.example.myapplication.bean.SystemsBean;
import com.example.myapplication.net.ResultCallBack;
import com.example.myapplication.util.HttpUtil;
import com.example.myapplication.util.ResultSubscriber;
import com.example.myapplication.util.RxUtils;

public class SystemsModel extends BaseModel {
    public void getSystemsData(final ResultCallBack<SystemsBean> resultCallBack) {
        addDisposable(
                HttpUtil.getInstance()
                .getSystemsService()
                .getData()
                .compose(RxUtils.<SystemsBean>ttFlowableTransformer())
                .subscribeWith(new ResultSubscriber<SystemsBean>() {
                    @Override
                    public void onNext(SystemsBean systemsBean) {
                        resultCallBack.onSuccess(systemsBean);
                    }
                })
        );
    }
}
